﻿<UserControl x:Class="UsingBxf.StatusDisplay"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:my="clr-namespace:UsingBxf"
             xmlns:bxfc="clr-namespace:Bxf.Converters;assembly=Bxf" xmlns:my1="clr-namespace:Bxf;assembly=Bxf">
  <UserControl.Resources>
    <bxfc:VisibilityConverter x:Key="VisibilityConverter"/>
    <bxfc:VisibilityConverter x:Key="NotVisibilityConverter" Invert="True"/>
    <CollectionViewSource x:Key="statusViewSource" d:DesignSource="{d:DesignInstance my1:Status, CreateList=True}" />
  </UserControl.Resources>
  <Grid>
    <StackPanel Orientation="Horizontal" DataContext="{StaticResource statusViewSource}" Margin="3">
      <Rectangle Height="20" Width="20" Fill="Green" Visibility="{Binding Path=IsOk, Converter={StaticResource VisibilityConverter}}" Margin="3" />
      <Rectangle Height="20" Width="20" Fill="Red" Visibility="{Binding Path=IsOk, Converter={StaticResource NotVisibilityConverter}}" Margin="3" />
      <Rectangle Height="20" Width="20" Fill="Yellow" Visibility="{Binding Path=IsBusy, Converter={StaticResource VisibilityConverter}}" Margin="3" />
      <TextBlock MinWidth="150" Text="{Binding Path=Text}" Margin="3" />
      <ContentControl Content="{Binding Path=Visual}" Margin="3" />
    </StackPanel>
  </Grid>
</UserControl>
